-
Notifications
You must be signed in to change notification settings - Fork 786
Restore and fix SpillPointers pass #4570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I tried making an example test (this code is far too big of course!) https://gist.github.com/ChrisJefferson/3d0813c40b130d1da5e04dc92cc5b36c -- also a second file containing a function With |
@ChrisJefferson Thanks! The challenge will be testing it here in binaryen though. I'm not sure atm how to do that. I also probably won't have time to look into it soon, sorry, but perhaps someone else can take this PR as a starting point. |
Thanks. Is there any place where a test might live? (I could take a look at existing tests), or is there not really a test framework to run an optimiser on some code, and check the result? |
@ChrisJefferson Sorry for the late response. We do have tests to run the optimizer and see the code that results ( However, this has come up again in emscripten-core/emscripten#17131 (comment) and so I think we should just land this, and figure out more detailed testing later (perhaps on the emscripten side?) |
src/abi/stack.h
Outdated
// used by Emscripten. First, look for a global initialized to an | ||
// imported variable named "STACKTOP" in environment "env". | ||
auto* stackPointer = | ||
GlobalUtils::getGlobalInitializedToImport(wasm, ENV, "STACKTOP"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
STACKTOP
is not a thing in emscripten anymore.
src/abi/stack.h
Outdated
if (globalGet) { | ||
stackPointer = wasm.getGlobal(globalGet->name); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have getStackPointerGlobal in src/wasm-emscripten.h
today
Would be nice to had a more readable/smaller test in Shame about re-introducing those two header files just for this one pass :( |
Nice, thanks, I think in this PR it's best to keep the test identical to before, so this is a clean reversion of the removal. We can improve the test later if we want. Updated after feedback. |
Oh, we can at least remove one header here, I did that now: it is easy to get the pointer type since we've added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly rubberstamp LGTM since this is a revert. It would be nice to port the test to lit, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good
Reverts the removal in #3261, fixes compile errors in internal API
changes since then, and flips the direction of the stack for the
wasm backend.
(Can see individual commits for each part of that.)
We should figure out a way to actually test this, though, if we want
to restore it.